package net.youyi.crazycopyer.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import net.youyi.crazycopyer.R;
import net.youyi.crazycopyer.entity.Discuss;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xzp on 15/11/9.
 */
public class DiscussAdapter extends BaseRecyclerAdapter<Discuss>{
    public DiscussAdapter(Context context) {
        super(context);
        List<Discuss> list=new ArrayList<Discuss>();
        for(int i=0;i<3+10;i++){
            list.add(new Discuss());
        }
        setList(list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        if(viewType==0){
            View view= LayoutInflater.from(getContext()).inflate(R.layout.discuss_item,parent,false);

            return new DiscussHolder(view);
        }
        else {
            View view=LayoutInflater.from(getContext()).inflate(R.layout.more_discuss_item,parent,false);
            return new MoreHolder(view);
        }
    }

    @Override
    public int getViewType(int position) {
        if(position==3)
            return 1;
        return 0;
    }

    @Override
    public int getItemCount() {
        return super.getItemCount()+1;
    }

    @Override
    public void onBindHolder(RecyclerView.ViewHolder holder, int position) {

    }
    private class DiscussHolder extends ClickableViewHolder{
        public DiscussHolder(View itemView) {
            super(itemView);
        }
    }
    private class MoreHolder extends RecyclerView.ViewHolder{
        public MoreHolder(View itemView) {
            super(itemView);
        }
    }
}
